<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.alipay.config.*"%>
<%@ page import="com.alipay.util.*"%>
<%@ page import="java.util.HashMap"%>
<%@ page import="java.util.Map"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>支付宝纯担保交易接口</title>
	</head>
	<%
		String out_trade_no = new String(request.getParameter("hiddentid"));
		String subject = new String(request.getParameter("hiddentname"));
		String price = new String(request.getParameter("totalprice"));

		String logistics_fee = "0.00";
		String logistics_type = "EXPRESS";
		String logistics_payment = "BUYER_PAY";
		String logistics_fee_1 = "20.00";
		String logistics_type_1 = "POST";
		String logistics_payment_1 = "BUYER_PAY";
		String logistics_fee_2 = "30.00";
		String logistics_type_2 = "EMS";
		String logistics_payment_2 = "BUYER_PAY";

		String body="无";//订单描述
		String show_url ="http://chezhude.com";
		//String show_url ="http://chezhude.com/showProduct?productId=&&bgPic=''";//商品展示地址
		String receive_name = new String(request.getParameter("receiveName"));
		//String receive_address = new String(request.getParameter("address"));
		String receive_address = new String(request.getParameter("receiveProvince").substring(6)+request.getParameter("receiveCity").substring(7)+request.getParameter("address"));
		String receive_zip = new String(request.getParameter("postCode"));
		String receive_phone = new String(request.getParameter("phone1")+"-"+request.getParameter("phone2"));
		String receive_mobile = new String(request.getParameter("mobilePhone"));
		//把请求参数打包成数组
		Map<String, String> sParaTemp = new HashMap<String, String>();
		sParaTemp.put("service", "create_partner_trade_by_buyer");
        sParaTemp.put("partner", AlipayConfig.partner);
        sParaTemp.put("_input_charset", AlipayConfig.input_charset);
		sParaTemp.put("payment_type", "1");
		sParaTemp.put("notify_url", AlipayConfig.notify_url);
		sParaTemp.put("return_url", AlipayConfig.return_url);
		sParaTemp.put("seller_email", AlipayConfig.seller_email);
		sParaTemp.put("out_trade_no", out_trade_no);
		sParaTemp.put("subject", subject);
		sParaTemp.put("price", price);
		sParaTemp.put("quantity", "1");
		sParaTemp.put("logistics_fee", logistics_fee);
		sParaTemp.put("logistics_type", logistics_type);
		sParaTemp.put("logistics_payment", logistics_payment);
		sParaTemp.put("logistics_fee_1", logistics_fee_1);
		sParaTemp.put("logistics_type_1", logistics_type_1);
		sParaTemp.put("logistics_payment_1", logistics_payment_1);
		sParaTemp.put("logistics_fee_2", logistics_fee_2);
		sParaTemp.put("logistics_type_2", logistics_type_2);
		sParaTemp.put("logistics_payment_2", logistics_payment_2);
		sParaTemp.put("body", body);
		sParaTemp.put("show_url", show_url);
		sParaTemp.put("receive_name", receive_name);
		sParaTemp.put("receive_address", receive_address);
		sParaTemp.put("receive_zip", receive_zip);
		sParaTemp.put("receive_phone", receive_phone);
		sParaTemp.put("receive_mobile", receive_mobile);

		//建立请求
		String sHtmlText = AlipaySubmit.buildRequest(sParaTemp,"get","确认");
		out.println(sHtmlText);
	%>
	<body>
	</body>
</html>
